/****************************************************
/* DM420 MotorControl class for Arduino platform
/* Author: G.dab
/***************************************************/

#ifndef MOTORCONTROL_H
#define MOTORCONTROL_H

#include <Arduino.h>

enum State
{
    STOP,     // 空闲
    STEP,     // 指定步数
    CONTIUOUS // 持续运动
};

class MotorControl
{
public:
    MotorControl(int motorCount, int stepPins[], int dirPins[]);
    ~MotorControl();
    bool moveMotor(int targetMotor, int targetSteps, int speed);
    void loop();
    void log();

private:
    int motorCount;
    int *stepPins;
    int *dirPins;
    State *motorStates;
    int *motorSteps;
    int *motorSpeeds;

    void processSerialCommand(String command);
};

#endif